/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package numpad;

import java.awt.AWTException;
import java.awt.Robot;
import java.awt.event.KeyEvent;
import java.net.URL;
import java.util.ResourceBundle;
import java.util.logging.Level;
import java.util.logging.Logger;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.input.MouseEvent;

/**
 *
 * @author Dennis
 */
public class NumPadController implements Initializable {
    
    private Robot robot;
    private boolean numPadEnabled = true;

    public boolean isNumPadEnabled() {
        return numPadEnabled;
    }
    
    @FXML
    private void handleButtonEnableNum() {
        numPadEnabled = !numPadEnabled;
    }
    
    @FXML
    private void handleButtonDivide() {
        robot.keyPress(KeyEvent.VK_DIVIDE);
    }
    
    @FXML
    private void handleButtonMinus() {
        robot.keyPress(KeyEvent.VK_MINUS);
    }
    
    @FXML
    private void handleButtonMultiply() {
        robot.keyPress(KeyEvent.VK_MULTIPLY);
    }
    
    @FXML
    private void handleButtonPlus() {
        robot.keyPress(KeyEvent.VK_PLUS);
    }
    
    @FXML
    private void handleButtonEnter() {
        robot.keyPress(KeyEvent.VK_ENTER);
    }
    
    @FXML
    private void handleButtonComma() {
        robot.keyPress(KeyEvent.VK_COMMA);
    }
    
    @FXML
    private void handleButtonZero() {
        robot.keyPress(KeyEvent.VK_0);
    }
    
    @FXML
    private void handleButtonOne() {
        robot.keyPress(KeyEvent.VK_1);
    }
    
    @FXML
    private void handleButtonTwo() {
        robot.keyPress(KeyEvent.VK_2);
    }
    
    @FXML
    private void handleButtonThree() {
        robot.keyPress(KeyEvent.VK_3);
    }
    
    @FXML
    private void handleButtonFour() {
        robot.keyPress(KeyEvent.VK_4);
    }
    
    @FXML
    private void handleButtonFive() {
        robot.keyPress(KeyEvent.VK_5);
    }
    
    @FXML
    private void handleButtonSix() {
        robot.keyPress(KeyEvent.VK_6);
    }
    
    @FXML
    private void handleButtonSeven() {
        robot.keyPress(KeyEvent.VK_7);
    }
    
    @FXML
    private void handleButtonEight() {
        robot.keyPress(KeyEvent.VK_8);
    }
    
    @FXML
    private void handleButtonNine() {
        robot.keyPress(KeyEvent.VK_9);
    }
    
    @Override
    public void initialize(URL url, ResourceBundle rb) {
        try {
            robot = new Robot();
        } catch (AWTException ex) {
            Logger.getLogger(NumPadController.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
}
